package cn.com.yusys.yusp.admin.web.rest;

import cn.com.yusys.yusp.admin.Utils.IDUtils;
import cn.com.yusys.yusp.admin.service.CustCenterService;
import cn.com.yusys.yusp.admin.service.MerchantManagementService;
import cn.com.yusys.yusp.commons.mapper.QueryModel;
import cn.com.yusys.yusp.commons.web.rest.dto.ResultDto;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static cn.com.yusys.yusp.admin.web.rest.CustCenterResource.judgeUserJurisdiction;

@RestController
@RequestMapping("/api/MerchantManagementResource")
public class MerchantManagementResource {

    @Resource
    private MerchantManagementService merchantManagementService;

    @GetMapping("/addMerchantManagement")
    public int addMerchantManagement(QueryModel queryModel) {
        queryModel.getCondition().put("id",IDUtils.getGuid());
        return merchantManagementService.addMerchantManagement(queryModel);
    }

    @GetMapping("/getMerchantManagementInfo")
    public ResultDto<List<Map<String, Object>>> getMerchantManagementInfo(QueryModel queryModel){
        judgeUserJurisdiction(queryModel,false);
        List<Map<String, Object>> list = merchantManagementService.getMerchantManagementInfo(queryModel);
        return new ResultDto<>(list);
    }

    @GetMapping("/getMerchantInformation")
    public ResultDto<Map<String, Object>> getMerchantInformation(QueryModel queryModel){
        Map<String, Object> map = merchantManagementService.getMerchantInformation(queryModel);
        return new ResultDto<>(map);
    }

    @GetMapping("/updateMerchantManagement")
    public ResultDto<Integer> updateMerchantManagement(QueryModel queryModel){
        return new ResultDto<>(merchantManagementService.updateMerchantManagement(queryModel));
    }


    @GetMapping("/deleteMerchantManagement")
    public ResultDto<Integer> deleteMerchantManagement(QueryModel queryModel) {
        List<String> MerchantManagementList = (List<String>)queryModel.getCondition().get("merchantNo");
        return new ResultDto<>(merchantManagementService.deleteMerchantManagement(MerchantManagementList));
    }



}
